﻿Imports System
Imports System.Workflow.ComponentModel

Namespace System.Workflow.Activities
    <Serializable> _
    Friend MustInherit Class StateMachineSubscription
        Implements IActivityEventListener([Of] QueueEventArgs)
        ' Methods
        Protected Sub New()
        End Sub

        Protected MustOverride Sub Enqueue(ByVal context As ActivityExecutionContext)

        Friend MustOverride Sub ProcessEvent(ByVal context As ActivityExecutionContext)

        Private Sub System.Workflow.ComponentModel.IActivityEventListener<System.Workflow.ComponentModel.QueueEventArgs>.OnEvent(ByVal sender As Object, ByVal e As QueueEventArgs) Implements IActivityEventListener([Of] QueueEventArgs).OnEvent
            Dim context As ActivityExecutionContext = [TryCast](sender,ActivityExecutionContext)
            If (context Is Nothing) Then
                Throw New ArgumentException(SR.Error_SenderMustBeActivityExecutionContext, "sender")
            End If
            Me.Enqueue(context)
        End Sub


        ' Properties
        Friend Property SubscriptionId As Guid
            Get
                Return Me._subscriptionId
            End Get
            Set(ByVal value As Guid)
                Me._subscriptionId = value
            End Set
        End Property


        ' Fields
        Private _subscriptionId As Guid
    End Class
End Namespace

